/**
 * @author wsf
 * @time 2019/6/15 1:35
 */
public class TwoSumListNode extends ListNode {

    public TwoSumListNode(int val) {
        super(val);
    }

    @Override
    public String toString() {
        String twoSumVal = "";
        return sum(this, twoSumVal);
    }

    private String sum(ListNode twoSumListNode, String twoSumVal) {
        twoSumVal += twoSumListNode.val;
        if (twoSumListNode.next != null) {
            twoSumVal = sum(twoSumListNode.next, twoSumVal);
        }
        return twoSumVal;
    }
}
